<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Model;

class Interview extends Model
{
	use HasDateTimeFormatter;
    protected $table = 'eb_interview';
    protected $fillable = [
       'prenatal_test',
       'hospital_id',
       'pt_hospital',
       'pt_date',
       'prenatal',
       'childbirth_hospital',
       'childbirth_date',
       'created_at',
       'childbirth_type',
       'pt_value',
       'type',
       'user_id',
       'family_id',
       'family_pregn_id',
    ];

    public static $typeTxt=[
        1=>'第一次产检追访',
        2=>'第二次产检追访',
        3=>'第三次产检追访',
        4=>'第四次产检追访',
        5=>'第五次产检追访',
    ];
    public static $ptValueTxt = [
        1=>'自然流产',2=>'人工流产',3=>'胎停育',4=>'贫血',5=>'妊娠合并糖尿病',6=>'甲减',7=>'妊娠合并高血压',8=>'畸形',9=>'其它体检不正常',
    ];
    public static $prenatalTxt = [
        1=>'正常',0=>'不正常',2=>'已分娩'
    ];
    public static $ctypeTxt = [
        0=>'顺产', 1=>'刨宫产',2=>'默认值'
    ];
    public function family(){
        return $this->hasOne(Family::class,'id','family_id');
    }
    public function familyPreg(){
        return $this->hasOne(FamilyPregn::class,'id','family_pregn_id');
    }
    public function user(){
        return $this->hasOne(User::class,'id','user_id');
    }
}
